.class final Ldgb/q;
.super Ljava/lang/Object;
.source "SourceFile"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Ldgb/q$a;
    }
.end annotation


# instance fields
.field private final a:Landroid/content/Context;

.field private final b:Ldgb/r;

.field private final c:Ldgb/q$a;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 1

    .line 1
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 2
    iput-object p1, p0, Ldgb/q;->a:Landroid/content/Context;

    .line 3
    new-instance v0, Ldgb/r;

    invoke-direct {v0, p1}, Ldgb/r;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Ldgb/q;->b:Ldgb/r;

    .line 4
    new-instance p1, Ldgb/q$a;

    iget-object v0, p0, Ldgb/q;->a:Landroid/content/Context;

    invoke-direct {p1, p0, v0}, Ldgb/q$a;-><init>(Ldgb/q;Landroid/content/Context;)V

    iput-object p1, p0, Ldgb/q;->c:Ldgb/q$a;

    return-void
.end method

.method private a(Lorg/json/JSONArray;Lorg/json/JSONArray;)V
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Lorg/json/JSONException;
        }
    .end annotation

    const/4 v0, 0x0

    .line 3
    :goto_0
    invoke-virtual {p2}, Lorg/json/JSONArray;->length()I

    move-result v1

    if-ge v0, v1, :cond_0

    .line 4
    invoke-virtual {p2, v0}, Lorg/json/JSONArray;->get(I)Ljava/lang/Object;

    move-result-object v1

    invoke-virtual {p1, v1}, Lorg/json/JSONArray;->put(Ljava/lang/Object;)Lorg/json/JSONArray;

    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    :cond_0
    return-void
.end method

.method private b()Z
    .locals 15

    .line 1
    iget-object v0, p0, Ldgb/q;->a:Landroid/content/Context;

    invoke-static {v0}, Ldgb/z;->a(Landroid/content/Context;)Z

    move-result v0

    const-string v1, "stat.EventReporter"

    const/4 v2, 0x0

    if-eqz v0, :cond_d

    const/4 v0, 0x4

    new-array v3, v0, [Ljava/lang/String;

    const-string v4, "d"

    aput-object v4, v3, v2

    const-string v4, "i"

    const/4 v5, 0x1

    aput-object v4, v3, v5

    const/4 v4, 0x2

    const-string v6, "r"

    aput-object v6, v3, v4

    const/4 v4, 0x3

    const-string v6, "o"

    aput-object v6, v3, v4

    const/16 v4, 0x3e8

    .line 2
    new-instance v6, Ljava/util/HashMap;

    invoke-direct {v6}, Ljava/util/HashMap;-><init>()V

    const/4 v7, 0x0

    move-object v9, v7

    const/4 v8, 0x0

    :goto_0
    if-ge v8, v0, :cond_5

    .line 3
    aget-object v10, v3, v8

    if-gtz v4, :cond_0

    goto :goto_2

    .line 4
    :cond_0
    iget-object v11, p0, Ldgb/q;->a:Landroid/content/Context;

    invoke-virtual {v11, v10, v2}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v11

    const-string v12, "pk"

    .line 5
    invoke-interface {v11, v12, v7}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v11

    if-nez v11, :cond_1

    goto :goto_1

    :cond_1
    if-nez v9, :cond_2

    move-object v9, v11

    .line 6
    :cond_2
    iget-object v12, p0, Ldgb/q;->b:Ldgb/r;

    invoke-virtual {v12, v10}, Ldgb/r;->a(Ljava/lang/String;)Ldgb/m;

    move-result-object v12

    .line 7
    invoke-virtual {v12}, Ldgb/m;->c()Z

    move-result v13

    if-eqz v13, :cond_3

    goto :goto_1

    .line 8
    :cond_3
    invoke-virtual {v12}, Ldgb/m;->a()V

    .line 9
    :try_start_0
    invoke-virtual {v12, v4}, Ldgb/m;->b(I)Ldgb/m$a;

    move-result-object v13

    if-eqz v13, :cond_4

    .line 10
    invoke-virtual {v13}, Ldgb/m$a;->a()Lorg/json/JSONArray;

    move-result-object v14

    invoke-virtual {v14}, Lorg/json/JSONArray;->length()I

    move-result v14

    if-lez v14, :cond_4

    invoke-virtual {v9, v11}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v11

    if-eqz v11, :cond_4

    .line 11
    invoke-virtual {v13}, Ldgb/m$a;->a()Lorg/json/JSONArray;

    move-result-object v11

    invoke-virtual {v11}, Lorg/json/JSONArray;->length()I

    move-result v11

    sub-int/2addr v4, v11

    .line 12
    invoke-interface {v6, v10, v13}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 13
    :cond_4
    invoke-virtual {v12}, Ldgb/m;->b()V

    :goto_1
    add-int/lit8 v8, v8, 0x1

    goto :goto_0

    :catchall_0
    move-exception v0

    invoke-virtual {v12}, Ldgb/m;->b()V

    throw v0

    .line 14
    :cond_5
    :goto_2
    invoke-interface {v6}, Ljava/util/Map;->size()I

    move-result v0

    if-nez v0, :cond_7

    .line 15
    sget-boolean v0, Ldgb/z;->b:Z

    if-eqz v0, :cond_6

    const-string v0, "There is no data to upload!"

    .line 16
    invoke-static {v1, v0}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    :cond_6
    return v5

    .line 17
    :cond_7
    new-instance v0, Lorg/json/JSONArray;

    invoke-direct {v0}, Lorg/json/JSONArray;-><init>()V

    .line 18
    invoke-interface {v6}, Ljava/util/Map;->keySet()Ljava/util/Set;

    move-result-object v2

    invoke-interface {v2}, Ljava/util/Set;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :cond_8
    :goto_3
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v3

    if-eqz v3, :cond_9

    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v3

    check-cast v3, Ljava/lang/String;

    .line 19
    invoke-interface {v6, v3}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v3

    check-cast v3, Ldgb/m$a;

    .line 20
    :try_start_1
    invoke-virtual {v3}, Ldgb/m$a;->a()Lorg/json/JSONArray;

    move-result-object v3

    invoke-direct {p0, v0, v3}, Ldgb/q;->a(Lorg/json/JSONArray;Lorg/json/JSONArray;)V
    :try_end_1
    .catch Lorg/json/JSONException; {:try_start_1 .. :try_end_1} :catch_0

    goto :goto_3

    :catch_0
    move-exception v3

    .line 21
    sget-boolean v4, Ldgb/z;->d:Z

    if-eqz v4, :cond_8

    const-string v4, "Failed to add dumpResult!"

    .line 22
    invoke-static {v1, v4, v3}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto :goto_3

    .line 23
    :cond_9
    iget-object v1, p0, Ldgb/q;->c:Ldgb/q$a;

    invoke-virtual {v0}, Lorg/json/JSONArray;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v1, v9, v0}, Ldgb/q$a;->a(Ljava/lang/String;Ljava/lang/String;)I

    move-result v0

    .line 24
    invoke-static {v0}, Ldgb/t;->b(I)Z

    move-result v1

    if-eqz v1, :cond_b

    .line 25
    invoke-interface {v6}, Ljava/util/Map;->keySet()Ljava/util/Set;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;

    move-result-object v0

    :goto_4
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v2

    if-eqz v2, :cond_a

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Ljava/lang/String;

    .line 26
    iget-object v3, p0, Ldgb/q;->b:Ldgb/r;

    invoke-virtual {v3, v2}, Ldgb/r;->a(Ljava/lang/String;)Ldgb/m;

    move-result-object v3

    .line 27
    invoke-virtual {v3}, Ldgb/m;->a()V

    .line 28
    :try_start_2
    invoke-interface {v6, v2}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Ldgb/m$a;

    invoke-virtual {v2}, Ldgb/m$a;->b()J

    move-result-wide v4

    invoke-virtual {v3, v4, v5}, Ldgb/m;->a(J)V
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_1

    .line 29
    invoke-virtual {v3}, Ldgb/m;->b()V

    goto :goto_4

    :catchall_1
    move-exception v0

    invoke-virtual {v3}, Ldgb/m;->b()V

    throw v0

    .line 30
    :cond_a
    iget-object v0, p0, Ldgb/q;->a:Landroid/content/Context;

    invoke-static {v0}, Ldgb/o;->b(Landroid/content/Context;)V

    goto :goto_5

    .line 31
    :cond_b
    invoke-static {v0}, Ldgb/t;->a(I)Z

    move-result v0

    if-eqz v0, :cond_c

    .line 32
    iget-object v0, p0, Ldgb/q;->a:Landroid/content/Context;

    invoke-static {v0}, Ldgb/o;->d(Landroid/content/Context;)V

    :cond_c
    :goto_5
    return v1

    .line 33
    :cond_d
    sget-boolean v0, Ldgb/z;->c:Z

    if-eqz v0, :cond_e

    const-string v0, "Network is unavilable!"

    .line 34
    invoke-static {v1, v0}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    :cond_e
    return v2
.end method


# virtual methods
.method public a()Z
    .locals 1

    .line 1
    iget-object v0, p0, Ldgb/q;->a:Landroid/content/Context;

    invoke-static {v0}, Ldgb/o;->a(Landroid/content/Context;)Z

    move-result v0

    if-eqz v0, :cond_0

    iget-object v0, p0, Ldgb/q;->a:Landroid/content/Context;

    invoke-static {v0}, Ldgb/o;->c(Landroid/content/Context;)Z

    move-result v0

    if-nez v0, :cond_0

    .line 2
    invoke-direct {p0}, Ldgb/q;->b()Z

    move-result v0

    goto :goto_0

    :cond_0
    const/4 v0, 0x0

    :goto_0
    return v0
.end method
